home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / CUCD / Sound / SPlayer / ARexxWebServer / webserver / counter.cgi next >
Text File  |  1998-06-29  |  692b  |  38 lines

  1. /*
  2. $VER: DFD Counter v1.0 alpha2 (30-Oct-96)
  3. */
  4.  
  5. options results
  6. path = 'amitcp:www/cgi-bin/'
  7.  
  8. parse arg data'+'opt
  9.  
  10. if index(data,"/")~=0 then exit
  11. if index(data,":")~=0 then exit
  12.  
  13. if open(x,path||data,'R') then do
  14.   number = readln(x)
  15.   if number<1 then number=0
  16.   call close(x)
  17.   number = number+1
  18.   ext=''
  19.   if opt=1 then do
  20.     ext='th' ; last1=right(number,1) ; last2=right(number,2)
  21.     if last1=1 then ext='st'
  22.     if last1=2 then ext='nd'
  23.     if last1=3 then ext='rd'
  24.     if last2>10 & last2<14 then ext='th'
  25.   end
  26.   call writech(STDOUT,number||ext)
  27. end
  28. else do
  29.   number=1
  30.   call writech(STDOUT,number'st')
  31. end
  32.  
  33. call open(y,path||data,'W')
  34. call writeln(y,number)
  35. call close(y)
  36.  
  37. exit
  38.